package com.liqi.items.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liqi.common.utils.DateUtils;
import com.liqi.items.domain.TCfgBranch;
import com.liqi.items.domain.VO.TCfgBranchVO;
import com.liqi.items.mapper.TCfgBranchMapper;
import com.liqi.items.service.ITCfgBranchService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 网点Service业务层处理
 *
 * @author Lwy
 * @date 2022-04-07
 */
@Service
public class TCfgBranchServiceImpl extends ServiceImpl<TCfgBranchMapper, TCfgBranch> implements ITCfgBranchService
{
    @Autowired
    private TCfgBranchMapper tCfgBranchMapper;

    /**
     * 查询网点
     *
     * @param id 网点主键
     * @return 网点
     */
    @Override
    public TCfgBranchVO selectTCfgBranchById(Long id)
    {
        return tCfgBranchMapper.selectTCfgBranchById(id);
    }

    /**
     * 查询网点列表
     *
     * @param tCfgBranch 网点
     * @return 网点
     */
    @Override
    public List<TCfgBranch> selectTCfgBranchList(TCfgBranch tCfgBranch)
    {
        return tCfgBranchMapper.selectTCfgBranchList(tCfgBranch);
    }

    @Override
    public List<TCfgBranchVO> selectTCfgBranchListByParentCode(String parentCode) {
        return tCfgBranchMapper.selectTCfgBranchListByParentCode(parentCode);
    }

    @Override
    public List<TCfgBranchVO> selectTCfgBranchDataByParentCode(String parentCode) {
        return tCfgBranchMapper.selectTCfgBranchDataByParentCode(parentCode);
    }

    @Override
    public TCfgBranch selectTCfgBranchListByBranchCode(String BranchCode) {
        return tCfgBranchMapper.selectTCfgBranchListByBranchCode(BranchCode);
    }

    @Override
    public TCfgBranch selectTCfgBranchByBranchName(String BranchName) {
        return tCfgBranchMapper.selectTCfgBranchByBranchName(BranchName);
    }


    @Override
    public List<TCfgBranch> selectTCfgBranchData() {
        return tCfgBranchMapper.selectTCfgBranchData();
    }

    /**
     * 新增网点
     *
     * @param tCfgBranch 网点
     * @return 结果
     */
    @Override
    public int insertTCfgBranch(TCfgBranch tCfgBranch)
    {
        tCfgBranch.setCreateTime(DateUtils.getNowDate());
        return tCfgBranchMapper.insertTCfgBranch(tCfgBranch);
    }

    /**
     * 修改网点
     *
     * @param tCfgBranch 网点
     * @return 结果
     */
    @Override
    public int updateTCfgBranch(TCfgBranch tCfgBranch)
    {
        tCfgBranch.setUpdateTime(DateUtils.getNowDate());
        return tCfgBranchMapper.updateTCfgBranch(tCfgBranch);
    }

    /**
     * 批量删除网点
     *
     * @param ids 需要删除的网点主键
     * @return 结果
     */
    @Override
    public int deleteTCfgBranchByIds(Long[] ids)
    {
        return tCfgBranchMapper.deleteTCfgBranchByIds(ids);
    }

    /**
     * 删除网点信息
     *
     * @param id 网点主键
     * @return 结果
     */
    @Override
    public int deleteTCfgBranchById(Long id)
    {
        return tCfgBranchMapper.deleteTCfgBranchById(id);
    }
}
